package project.teg.games.game.gestures;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import android.graphics.Point;
import android.graphics.PointF;
import project.teg.common.Border;
import project.teg.common.types.*;

@Root
public class Measurement {

	private DateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS");

	@Element
	public long id;

	private Date timeCreated;

	@Element
	public String timeCreatedString;

	@Element
	public DeviceType deviceType;

	@Element
	public HandlingType handlingType;

	@Element
	public float pathLength;

	@Element
	public GestureType gestureType;

	@Element
	public GestureShapeType gestureShapeType;

	@Element
	public int checkpointNumber;

	@Element
	public Border beginCheckpointBorder;

	@Element
	public Border endCheckpointBorder;

	@Element
	public String timeLevelStartString;

	private Date timeLevelStart;

	@Element
	public String timeSelectString;

	private Date timeSelect;

	@Element
	public String timeActionEndString;

	private Date timeActionEnd;

	@Element
	public double intervalLevelStartToSelect;

	@Element
	public double intervalSelectToActionEnd;

	@Element
	public boolean isTestSuccesful;

	@Element
	public int pathColor;

	@Element
	public int beginCheckPointColor;

	@Element
	public int endCheckpointColor;

	@Element
	public int internalCheckpointColor;

	@Element
	public int backgroundColor;

	@Element
	public boolean isBackgroundSolidColor;

	@Element
	public boolean isPathVisible;

	@Element
	public boolean isCheckpointIndexVisible;

	@Element
	public String beginPathLocationString;

	private PointF beginPathLocation;

	@Element
	public String endPathLocationString;

	private PointF endPathLocation;

	@Element
	public ScreenFieldType beginPathScreenField;

	@Element
	public ScreenFieldType endPathScreenField;

	@Element
	public double score;

	// new

	@Element
	public int dpi;

	@Element
	public String screenSizePxString;

	private Point screenSizePx;

	@Element
	public double dragLength;
	
	public boolean isSent;

	public long getId() {
		return id;
	}

	public Date getTimeCreated() {
		return timeCreated;
	}

	public String getTimeCreatedString() {
		return df.format(timeCreated);
	}

	public DeviceType getDeviceType() {
		return deviceType;
	}

	public HandlingType getHandlingType() {
		return handlingType;
	}

	public float getPathLength() {
		return pathLength;
	}

	public GestureType getGestureType() {
		return gestureType;
	}

	public GestureShapeType getGestureShapeType() {
		return gestureShapeType;
	}

	public int getCheckpointNumber() {
		return checkpointNumber;
	}

	public Border getBeginCheckpointBorder() {
		return beginCheckpointBorder;
	}

	public Border getEndCheckpointBorder() {
		return endCheckpointBorder;
	}

	public String getTimeLevelStartString() {
		return df.format(timeLevelStart);
	}

	public Date getTimeLevelStart() {
		return timeLevelStart;
	}

	public String getTimeSelectString() {
		return df.format(timeSelect);
	}

	public Date getTimeSelect() {
		return timeSelect;
	}

	public String getTimeActionEndString() {
		return df.format(timeActionEnd);
	}

	public Date getTimeActionEnd() {
		return timeActionEnd;
	}

	public double getIntervalLevelStartToSelect() {
		return intervalLevelStartToSelect;
	}

	public double getIntervalSelectToActionEnd() {
		return intervalSelectToActionEnd;
	}

	public boolean isTestSuccesful() {
		return isTestSuccesful;
	}

	public int getPathColor() {
		return pathColor;
	}

	public int getBeginCheckPointColor() {
		return beginCheckPointColor;
	}

	public int getEndCheckpointColor() {
		return endCheckpointColor;
	}

	public int getInternalCheckpointColor() {
		return internalCheckpointColor;
	}

	public int getBackgroundColor() {
		return backgroundColor;
	}

	public boolean isBackgroundSolidColor() {
		return isBackgroundSolidColor;
	}

	public boolean isPathVisible() {
		return isPathVisible;
	}

	public boolean isCheckpointIndexVisible() {
		return isCheckpointIndexVisible;
	}

	public PointF getBeginPathLocation() {
		return beginPathLocation;
	}

	public PointF getEndPathLocation() {
		return endPathLocation;
	}

	public ScreenFieldType getBeginPathScreenField() {
		return beginPathScreenField;
	}

	public ScreenFieldType getEndPathScreenField() {
		return endPathScreenField;
	}

	public double getScore() {
		return score;
	}

	public void setTimeCreated(Date timeCreated) {
		this.timeCreated = timeCreated;
		this.timeCreatedString = df.format(timeCreated);
	}

	public void setTimeLevelStart(Date timeLevelStart) {
		this.timeLevelStart = timeLevelStart;
		this.timeLevelStartString = df.format(timeLevelStart);
	}

	public void setTimeSelect(Date timeSelect) {
		this.timeSelect = timeSelect;
		this.timeSelectString = df.format(timeSelect);
	}

	public void setTimeActionEnd(Date timeActionEnd) {
		this.timeActionEnd = timeActionEnd;
		this.timeActionEndString = df.format(timeActionEnd);
	}

	public int getDpi() {
		return dpi;
	}

	public Point getScreenSizePx() {
		return screenSizePx;
	}

	public double getDragLength() {
		return dragLength;
	}

	public void setBeginPathLocation(PointF beginPathLocation) {
		this.beginPathLocation = beginPathLocation;
		this.beginPathLocationString = String.format("%f,%f",
				beginPathLocation.x, beginPathLocation.y);
	}

	public void setEndPathLocation(PointF endPathLocation) {
		this.endPathLocation = endPathLocation;
		this.endPathLocationString = String.format("%f,%f", endPathLocation.x,
				endPathLocation.y);
	}

	public void setScreenSizePx(Point screenSizePx) {
		this.screenSizePx = screenSizePx;
		this.screenSizePxString = String.format("%d,%d", screenSizePx.x,
				screenSizePx.y);
	}

}
